<template>
  <div class="d-flex">
    <div class="mr-2">
      <div class="d-flex justify-content-between mb-1">
        <div>
          <div v-show="!viewMode">
            <el-button type="primary" plain size="small" @click="onFinishCencus">
              <i class="fa fa-check-circle"></i>
              完成报告
            </el-button>
          </div>
          <div>
            <el-button type="primary" plain size="small" @click="onPrint">
              <i class="fa fa-print"></i>
              打印
            </el-button>
          </div>
        </div>
      </div>

      <div class="report-wrap">
        <div class="report-main" id="report-body">
          <div class="report-body">
            <div class="report-section">
              <h2 class="report-title">
                铜仁市农业信贷担保有限责任公司
                <br />
                企业担保贷款调查报告
              </h2>

              <div class="text-right font-weight-bold">
                项目编号：
                <span v-if="censusData.census_number">{{ censusData.census_number }}</span>
                <span v-else class="d-print-none">
                  <el-tooltip
                    class="item"
                    effect="dark"
                    content="尽调报告完成后，项目编号自动生成"
                    placement="bottom"
                  >
                    <el-button type="text" class="text-muted">
                      待定
                      <i class="fa fa-question-circle"></i>
                    </el-button>
                  </el-tooltip>
                </span>
              </div>

              <h3 class="report-section-title" align="center">项目基本信息</h3>
              <table class="table table-bordered">
                <colgroup>
                  <col width="15%" />
                  <col width="22%" />
                  <col width="20%" />
                  <col width="22%" />
                  <col width="21%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="13" align="center">项目基本信息</td>
                  </tr>
                  <tr>
                    <td>客户名</td>
                    <td colspan="3">{{ relatedData.customer_name }}</td>
                  </tr>
                  <tr>
                    <td>经营者姓名</td>
                    <td colspan="3">{{ relatedData.corp_name }}</td>
                  </tr>
                  <tr>
                    <td>借款主体</td>
                    <td colspan="3">{{ relatedData.customer_name }}</td>
                  </tr>
                  <tr>
                    <td>借款银行</td>
                    <td colspan="3">{{ censusData.bank_name }}</td>
                  </tr>
                  <tr>
                    <td>业务品种</td>
                    <td colspan="3">{{ censusData.business_type }}</td>
                  </tr>
                  <tr>
                    <td>申请担保金额(万元)</td>
                    <td>{{ relatedData.apply_funds }}</td>
                    <td>申请担保期限(年)</td>
                    <td>{{ censusData.warranty_period }}</td>
                  </tr>
                  <tr>
                    <td>银行借款利率</td>
                    <td>{{ censusData.bank_rate }}</td>
                    <td>担保费率</td>
                    <td>{{ censusData.warranty_rate }}</td>
                  </tr>
                  <tr>
                    <td>贷款用途</td>
                    <td colspan="3">{{ relatedData.funds_use_dir }}</td>
                  </tr>
                  <tr>
                    <td>调查A角</td>
                    <td>{{ relatedData.res_a_name }}</td>
                    <td>调查B角</td>
                    <td>{{ relatedData.res_b_name }}</td>
                  </tr>
                  <tr>
                    <td>风控人员</td>
                    <td v-if="!postStatus">
                      <select-staffper
                        v-model="censusData.risk_control_person"
                        @change="onReportSave('risk_control_person')"
                      ></select-staffper>
                    </td>
                    <td v-else>{{ censusData.risk_control_person }}</td>
                    <td>审批人员</td>
                    <td v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="1"
                        id="form-1-1"
                        placeholder="审批人员"
                        v-model="censusData.approval_person"
                        v-focus="'anchor-1-1'"
                        @blur="onReportSave('approval_person')"
                      ></textarea>
                    </td>
                    <td v-else>
                      <div class="text-indent" id="anchor-1-1">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-1-1'">
                          {{ censusData.approval_person }}
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td>受理日期</td>
                    <td>{{ $utils.dateFormat(censusData.accept_date, 'yyyy.MM.dd') }}</td>
                    <td>调查日期</td>
                    <td>{{ $utils.dateFormat(censusData.accept_date, 'yyyy.MM.dd') }}</td>
                  </tr>
                  <tr>
                    <td colspan="4" style="text-align: left">
                      重要性说明：此报告是按照相关制度规定，根据担保申请人提供和信贷人员收集的资料，经我们实地认真调查、核实、分析和整理后完成的。我们对报告内容的真实性、准确性、完整性和相关结论负责。
                    </td>
                  </tr>
                </tbody>
              </table>

              <h3 class="report-section-title" align="center">一、企业法人及企业基本情况</h3>
              <table class="table table-bordered">
                <colgroup>
                  <col width="15%" />
                  <col width="14%" />
                  <col width="14%" />
                  <col width="14%" />
                  <col width="15%" />
                  <col width="14%" />
                  <col width="14%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="13">
                      申请人及企业
                      <br />
                      基本情况
                    </td>
                  </tr>
                  <tr>
                    <td colspan="6">1.企业法人情况：</td>
                  </tr>
                  <tr>
                    <td>姓名</td>
                    <td>{{ shareholderData.real_name }}</td>
                    <td>身份证号</td>
                    <td>{{ shareholderData.id_card }}</td>
                    <td>联系电话</td>
                    <td>{{ shareholderData.mobile_no }}</td>
                  </tr>
                  <tr>
                    <td>性别</td>
                    <td>{{ enumSexType[shareholderData.sex] }}</td>
                    <td>学历</td>
                    <td>{{ enumEduType[shareholderData.education] }}</td>
                    <td>持股比例</td>
                    <td>{{ shareholderData.sh_rate }}%</td>
                  </tr>
                  <tr>
                    <td>公司职位</td>
                    <td>{{ shareholderData.positio }}</td>
                    <td>居住地址</td>
                    <td colspan="3">{{ shareholderData.address }}</td>
                  </tr>
                  <tr>
                    <td colspan="6">2.企业基本情况：</td>
                  </tr>
                  <tr>
                    <td>企业名称</td>
                    <td colspan="3">{{ relatedData.customer_name }}</td>
                    <td>成立日期</td>
                    <td>{{ $utils.dateFormat(infoData.established_date, 'yyyy.MM.dd') }}</td>
                  </tr>
                  <tr>
                    <td>所属行业</td>
                    <td>{{ enumFarmType[relatedData.farm_type] }}</td>
                    <td>注册资金(万元)</td>
                    <td>{{ infoData.register_funds }}</td>
                    <td>股东人数</td>
                    <td>{{ Presonsum }}</td>
                  </tr>
                  <tr>
                    <td>已投入资金</td>
                    <td>{{ relatedData.invest_total }}</td>
                    <td>企业负债</td>
                    <td>{{ relatedData.en_debt }}</td>
                    <td>上一年销售收入</td>
                    <td>{{ relatedData.last_year_income }}</td>
                  </tr>
                  <tr>
                    <td>经营年限</td>
                    <td>{{ infoData.bussiness_years }}</td>
                    <td>雇员人数</td>
                    <td>{{ employmentData.emp_total }}</td>
                    <td>社会统一信用代码</td>
                    <td>{{ relatedData.register_no }}</td>
                  </tr>
                  <tr>
                    <td>经营地址</td>
                    <td colspan="5">{{ relatedData.address }}</td>
                  </tr>
                  <tr>
                    <td colspan="6">3、企业简介</td>
                  </tr>
                  <tr>
                    <td colspan="6" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-1-3"
                        placeholder="历史沿革、经营模式、管理情况、战略计划"
                        v-model="censusData.business_history"
                        v-focus="'anchor-1-3'"
                        @blur="onReportSave('business_history')"
                      ></textarea>
                    </td>
                    <td colspan="6" v-else>
                      <div class="text-indent" id="anchor-1-3">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-1-3'">
                          {{ censusData.business_history }}
                        </div>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>

              <h3 class="report-section-title" align="center">二、申请人及企业征信情况</h3>
              <table class="table table-bordered">
                <colgroup>
                  <col width="11%" />
                  <col width="11%" />
                  <col width="11%" />
                  <col width="11%" />
                  <col width="11%" />
                  <col width="11%" />
                  <col width="11%" />
                  <col width="11%" />
                  <col width="12%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td :rowspan="17 + topData.length + Carddata.length + Foreign.length">
                      申请人及企业征信情况
                    </td>
                  </tr>
                  <tr>
                    <td colspan="7">1、在还借款状况：</td>
                    <td>金额：万元</td>
                  </tr>
                  <tr>
                    <td rowspan="2">借款人姓名</td>
                    <td rowspan="2">贷款银行</td>
                    <td rowspan="2">贷款品种</td>
                    <td rowspan="2">贷款金额</td>
                    <td colspan="2">贷款期限</td>
                    <td rowspan="2">贷款余额</td>
                    <td rowspan="2">信用状况</td>
                  </tr>
                  <tr>
                    <td>开始时间</td>
                    <td>结束时间</td>
                  </tr>

                  <template v-for="(d, index) in topData">
                    <tr :key="`loan-${index}`">
                      <td :rowspan="d.data.rowspan" v-if="!d.data.show">{{ d.data.name }}</td>
                      <td>{{ d.data.loan_bank }}</td>
                      <td>
                        <span v-if="d.data.loan_variety">{{ d.data.loan_variety }}</span>
                        <span v-else>—</span>
                      </td>
                      <td>
                        <span v-if="d.data.loan_funds">{{ d.data.loan_funds }}</span>
                        <span v-else>—</span>
                      </td>
                      <td>{{ $utils.dateFormat(d.data.start_date, 'yyyy.MM.dd') }}</td>
                      <td>{{ $utils.dateFormat(d.data.end_date, 'yyyy.MM.dd') }}</td>
                      <td>
                        <span v-if="d.data.loan_left">{{ d.data.loan_left }}</span>
                        <span v-else>—</span>
                      </td>
                      <td>
                        <span v-if="d.data.return_situation">{{ d.data.return_situation }}</span>
                        <span v-else>—</span>
                      </td>
                    </tr>
                    <tr v-if="!d.data.rowspan || d.data.rowspan === 1" :key="`loan-a-${index}`">
                      <td>合计：</td>
                      <td>—</td>
                      <td>—</td>
                      <td>{{ d.data.sum }}万元</td>
                      <td>—</td>
                      <td>—</td>
                      <td>{{ d.data.leftsum }}万元</td>
                      <td>—</td>
                    </tr>
                    <tr v-if="!d.data.rowspan || d.data.rowspan === 1" :key="`loan-b-${index}`">
                      <td colspan="8" v-if="!postStatus">
                        <textarea
                          type="text"
                          class="form-control d-print-none"
                          rows="4"
                          id="form-2-1"
                          placeholder="请填写备注"
                          v-model="d.remark"
                          v-focus="'anchor-2-1'"
                          @blur="onCreditSave(d.remark, d.data.datum_customer_shareholder_id)"
                        ></textarea>
                      </td>
                      <td colspan="8" v-else>
                        <div class="text-indent" id="anchor-2-1">
                          <div class="edit-eara" v-anchor:report-edit.focus="'form-2-1'">
                            {{ d.remark }}
                          </div>
                        </div>
                      </td>
                    </tr>
                  </template>

                  <tr>
                    <td colspan="8">2、信用卡使用状况</td>
                  </tr>
                  <tr>
                    <td>用卡人</td>
                    <td colspan="2">信用卡持有张数</td>
                    <td>授信总额</td>
                    <td>已用额度</td>
                    <td colspan="2">最近6个月平均使用额度</td>
                    <td>信用状况</td>
                  </tr>
                  <tr v-for="(p, index) of Carddata" :key="`car-` + index">
                    <td :rowspan="p.rowspan" style="vertical-align: middle" v-if="!p.show">
                      {{ p.name }}
                    </td>
                    <td colspan="2">
                      <span v-if="p.card_amount">{{ p.card_amount }}</span>
                      <span v-else>—</span>
                    </td>
                    <td>
                      <span v-if="p.card_funds">{{ p.card_funds }}</span>
                      <span v-else>—</span>
                    </td>
                    <td>
                      <span v-if="p.used_card_funds">{{ p.used_card_funds }}</span>
                      <span v-else>—</span>
                    </td>
                    <td colspan="2">
                      <span v-if="p.avg_card_funds">{{ p.avg_card_funds }}</span>
                      <span v-else>—</span>
                    </td>
                    <td>
                      <span v-if="p.is_normal">{{ enumEleUseType[p.is_normal] }}</span>
                      <span v-else>—</span>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="8" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-2-2"
                        placeholder="请填写备注"
                        v-model="cardData.overdue_des"
                        v-focus="'anchor-2-2'"
                        @blur="onCredsumbit('overdue_des')"
                      ></textarea>
                    </td>
                    <td colspan="8" v-else>
                      <div class="text-indent" id="anchor-2-2">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-2-2'">
                          {{ cardData.overdue_des }}
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="8">3、申请人对外担保情况（含家庭成员对外担保情况）</td>
                  </tr>
                  <tr>
                    <td colspan="2">担保对象</td>
                    <td colspan="2">担保期限(天)</td>
                    <td colspan="2">担保额度(万元)</td>
                    <td colspan="2">担保余额(万元)</td>
                  </tr>
                  <tr v-for="(p, index) of Foreign" :key="`for-` + index">
                    <td colspan="2">
                      <span v-if="p.warrant_object">{{ p.warrant_object }}</span>
                      <span v-else>—</span>
                    </td>
                    <td colspan="2">
                      <span v-if="p.warrant_period">{{ p.warrant_period }}</span>
                      <span v-else>—</span>
                    </td>
                    <td colspan="2">
                      <span v-if="p.warrant_funds">{{ p.warrant_funds }}</span>
                      <span v-else>—</span>
                    </td>
                    <td colspan="2">
                      <span v-if="p.warrant_left_funds">{{ p.warrant_left_funds }}</span>
                      <span v-else>—</span>
                    </td>
                  </tr>
                </tbody>
              </table>

              <h3 class="report-section-title" align="center">三、非财务情况分析</h3>
              <table
                class="table table-bordered"
                v-for="(p, index) in dataInfoSh"
                :key="`sh-${index}`"
              >
                <colgroup>
                  <col width="11%" />
                  <col width="12%" />
                  <col width="12%" />
                  <col width="13%" />
                  <col width="13%" />
                  <col width="13%" />
                  <col width="13%" />
                  <col width="13%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="15">
                      非财务情况
                      <br />
                      分析
                    </td>
                  </tr>
                  <tr>
                    <td colspan="7">
                      <span>{{ index + 1 }}、</span>
                      <span>{{ enumCorpType[p.is_corp] }}</span>
                      履历及期间积累情况
                    </td>
                  </tr>
                  <tr>
                    <td>名称</td>
                    <td>{{ p.real_name }}</td>
                    <td>证号号码</td>
                    <td colspan="2">{{ p.id_card || '-' }}</td>
                    <td>持股比例</td>
                    <td>{{ p.sh_rate ? `${p.sh_rate}%` : '-' }}</td>
                  </tr>
                  <tr v-if="p.is_corp !== '4'">
                    <td>性别</td>
                    <td>{{ enumSexType[p.sex] }}</td>
                    <td>学历</td>
                    <td>{{ p.education ? enumEduType[p.education] : '-' }}</td>
                    <td>联系电话</td>
                    <td colspan="2">{{ p.mobile_no || '-' }}</td>
                  </tr>
                  <tr v-else>
                    <td>出资方式</td>
                    <td>{{ p.invest_method }}</td>
                    <td>认缴出资额</td>
                    <td>{{ p.invest_funds }}</td>
                    <td>缴付期限</td>
                    <td colspan="2">{{ $utils.dateFormat(p.invest_rate, 'yyyy.MM') }}</td>
                  </tr>
                  <tr v-if="p.is_corp !== '4'">
                    <td>居住地址</td>
                    <td colspan="3">{{ p.address || '-' }}</td>
                    <td>婚姻状况</td>
                    <td colspan="2">
                      {{ p.marriage_status ? enumMarrType[p.marriage_status] : '-' }}
                    </td>
                  </tr>
                  <tr v-else>
                    <td>居住地址</td>
                    <td colspan="6">{{ p.address || '-' }}</td>
                  </tr>
                  <template v-if="p.is_corp !== '4'">
                    <tr>
                      <td :rowspan="p.handEdu.length + 1">受教育经历</td>
                      <td colspan="2">起止时间</td>
                      <td>年龄阶段</td>
                      <td>教育机构</td>
                      <td>专业</td>
                      <td>备注</td>
                    </tr>
                    <tr v-for="(edu, j) of p.handEdu" :key="`edu-${index}-${j}`">
                      <td colspan="2">{{ edu.datePeriod }}</td>
                      <td>{{ edu.age_inter || '-' }}</td>
                      <td>{{ edu.education_mech || '-' }}</td>
                      <td>{{ edu.profession || '-' }}</td>
                      <td>{{ edu.remark || '-' }}</td>
                    </tr>
                    <tr>
                      <td :rowspan="p.workExp.length + 1">工作经历</td>
                      <td>起止时间</td>
                      <td>年龄阶段</td>
                      <td>工作单位</td>
                      <td>职务</td>
                      <td>资产积累(万元)</td>
                      <td>大额开支</td>
                    </tr>
                    <tr v-for="(job, k) of p.workExp" :key="`work-${index}-${k}`">
                      <td>{{ job.datePeriod }}</td>
                      <td>{{ job.age_inter || '-' }}</td>
                      <td>{{ job.work_unit || '-' }}</td>
                      <td>{{ job.job || '-' }}</td>
                      <td>{{ job.assets_total || '-' }}</td>
                      <td>{{ job.assets_total || '-' }}</td>
                    </tr>
                  </template>
                </tbody>
              </table>
              <table class="table table-bordered">
                <colgroup>
                  <col width="11%" />
                  <col width="12%" />
                  <col width="12%" />
                  <col width="13%" />
                  <col width="13%" />
                  <col width="13%" />
                  <col width="13%" />
                  <col width="13%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="15">个人/公司财产</td>
                  </tr>
                  <tr>
                    <td colspan="7">个人/公司财产</td>
                  </tr>
                  <tr>
                    <td>权属情况</td>
                    <td>资产名</td>
                    <td>类型</td>
                    <td>所在位置</td>
                    <td>购置时间</td>
                    <td>价值（万元）</td>
                    <td>权证情况</td>
                  </tr>
                  <tr v-for="(p, index) of assetsData" :key="`assets-` + index">
                    <td>{{ enumTypeer[p.assets_belong_type] }}</td>
                    <td>{{ p.assets_name || '-' }}</td>
                    <td>{{ enumAssetsType[p.assets_type] }}</td>
                    <td>{{ p.address_detail || '-' }}</td>
                    <td>{{ $utils.dateFormat(p.purchase_date, 'yyyy') }}</td>
                    <td>{{ p.assets_value || '-' }}</td>
                    <td>{{ enumOwnSit[p.own_sit] }}</td>
                  </tr>
                </tbody>
              </table>
              <table class="table table-bordered">
                <colgroup>
                  <col width="11%" />
                  <col width="18%" />
                  <col width="18%" />
                  <col width="18%" />
                  <col width="18%" />
                  <col width="17%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td colspan="6">
                      2、供产销情况分析（主要原辅材料、主要供应商、主要购货商，合作时间，结算情况）
                    </td>
                  </tr>
                  <tr>
                    <td :rowspan="Gdata.length + 4">主要供货商</td>
                  </tr>
                  <tr>
                    <td>供应商名称</td>
                    <td>商品及型号</td>
                    <td>单价（元）</td>
                    <td>数量</td>
                    <td>金额（万元）</td>
                  </tr>
                  <tr v-for="(p, index) of Gdata" :key="`gda-` + index">
                    <td>{{ p.sm_name || '-' }}</td>
                    <td>{{ p.sm_product || '-' }}</td>
                    <td>{{ p.current_year_price || '-' }}</td>
                    <td>{{ p.current_year_amount || '-' }}</td>
                    <td>{{ p.current_year_total || '-' }}</td>
                  </tr>
                  <tr>
                    <td>合计：</td>
                    <td>-</td>
                    <td>—</td>
                    <td>—</td>
                    <td>{{ all }}</td>
                  </tr>
                  <tr>
                    <td colspan="5" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-3-1"
                        placeholder="采购模式分析："
                        v-model="censusData.purchase_model_des"
                        v-focus="'anchor-3-1'"
                        @blur="onReportSave('purchase_model_des')"
                      ></textarea>
                    </td>
                    <td colspan="5" v-else>
                      <div class="text-indent" id="anchor-3-1">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-3-1'">
                          {{ censusData.purchase_model_des }}
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td :rowspan="Xdata.length + 4">主要销货商</td>
                  </tr>
                  <tr>
                    <td>客户名称</td>
                    <td>商品及型号</td>
                    <td>单价（元）</td>
                    <td>数量</td>
                    <td>金额（万元）</td>
                  </tr>
                  <tr v-for="(p, index) of Xdata" :key="`xda-` + index">
                    <td>{{ p.sm_name }}</td>
                    <td>{{ p.sm_product }}</td>
                    <td>{{ p.current_year_price }}</td>
                    <td>{{ p.current_year_amount }}</td>
                    <td>{{ p.current_year_total }}</td>
                  </tr>
                  <tr>
                    <td>合计：</td>
                    <td>-</td>
                    <td>—</td>
                    <td>—</td>
                    <td>{{ All }}</td>
                  </tr>
                  <tr>
                    <td colspan="5" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-3-2"
                        placeholder="销售模式分析："
                        v-model="censusData.sell_model_des"
                        v-focus="'anchor-3-2'"
                        @blur="onReportSave('sell_model_des')"
                      ></textarea>
                    </td>
                    <td colspan="5" v-else>
                      <div class="text-indent" id="anchor-3-2">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-3-2'">
                          {{ censusData.sell_model_des }}
                        </div>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>

              <h3 class="report-section-title" align="center">四、财务情况分析</h3>
              <table class="table table-bordered">
                <colgroup>
                  <col width="14%" />
                  <col width="14%" />
                  <col width="14%" />
                  <col width="14%" />
                  <col width="14%" />
                  <col width="15%" />
                  <col width="15%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="16">财务情况分析</td>
                  </tr>
                  <tr>
                    <td colspan="6">1、财务报表----资金来源情况</td>
                  </tr>
                  <tr>
                    <td colspan="4">
                      资产负债情况&nbsp;&nbsp;时间：{{
                        $utils.dateFormat(FinanceData.report_date, 'yyyy.MM')
                      }}
                    </td>
                    <td colspan="2">
                      损益情况&nbsp;时间：{{
                        $utils.dateFormat(FinanceData.report_date, 'yyyy.MM')
                      }}
                    </td>
                  </tr>
                  <tr>
                    <td>货币资金(元)</td>
                    <td>{{ FinanceData.currency }}</td>
                    <td>银行借款(元)</td>
                    <td>{{ FinanceData.bank_load }}</td>
                    <td>销售收入(元)</td>
                    <td>{{ FinanceData.sale_income }}</td>
                  </tr>
                  <tr>
                    <td>其他应收账款(元)</td>
                    <td>{{ FinanceData.receivables }}</td>
                    <td>应付账款(元)</td>
                    <td>{{ FinanceData.should_charge }}</td>
                    <td>销售成本(元))</td>
                    <td>{{ FinanceData.sale_cost }}</td>
                  </tr>
                  <tr>
                    <td>预付账款(元)</td>
                    <td>{{ FinanceData.pre_charge }}</td>
                    <td>预收账款(元)</td>
                    <td>{{ FinanceData.pre_receivables }}</td>
                    <td>销售毛利(元)</td>
                    <td>{{ FinanceData.sale_profit }}</td>
                  </tr>
                  <tr>
                    <td>存货(元)</td>
                    <td>{{ FinanceData.stock }}</td>
                    <td>其他负债(元)</td>
                    <td>{{ FinanceData.other_debt }}</td>
                    <td>费用(元)</td>
                    <td>{{ FinanceData.cost }}</td>
                  </tr>
                  <tr>
                    <td>固定资产(元)</td>
                    <td>{{ FinanceData.fixed_assets }}</td>
                    <td>总负债(元)</td>
                    <td>{{ FinanceData.total_debt }}</td>
                    <td>营业外收入(元)</td>
                    <td>{{ FinanceData.busi_out_income }}</td>
                  </tr>
                  <tr>
                    <td>其他经营性资产(元)</td>
                    <td>{{ FinanceData.busi_assets }}</td>
                    <td>权益(元)</td>
                    <td>{{ FinanceData.equity }}</td>
                    <td>净利润(元)</td>
                    <td>{{ FinanceData.net_profit }}</td>
                  </tr>
                  <tr>
                    <td>总资产(元)</td>
                    <td>{{ FinanceData.total_assets }}</td>
                    <td>负债及权益(元)</td>
                    <td>{{ FinanceData.debt_equity }}</td>
                    <td colspan="2">-</td>
                  </tr>
                  <tr>
                    <td colspan="6" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-4-1"
                        placeholder="请填写备注"
                        v-model="censusData.finance_remark"
                        v-focus="'anchor-4-1'"
                        @blur="onReportSave('finance_remark')"
                      ></textarea>
                    </td>
                    <td colspan="6" v-else>
                      <div class="text-indent" id="anchor-4-1">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-4-1'">
                          {{ censusData.finance_remark }}
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="6">2、主要财务指标———费用投入情况</td>
                  </tr>
                  <tr>
                    <td>资产负债率</td>
                    <td>{{ normdata.assets_rate }}</td>
                    <td>流动比率</td>
                    <td>{{ normdata.flow_rate }}</td>
                    <td>速动比率</td>
                    <td>{{ normdata.quick_rate }}</td>
                  </tr>
                  <tr>
                    <td>应收账款周转率</td>
                    <td>{{ normdata.account_rec_rate }}</td>
                    <td>存货周转率</td>
                    <td>{{ normdata.inv_turn_rate }}</td>
                    <td>总资产周转率</td>
                    <td>{{ normdata.assets_turn_rate }}</td>
                  </tr>
                  <tr>
                    <td>销售毛利率</td>
                    <td>{{ normdata.sales_rate }}</td>
                    <td>总资产收益率</td>
                    <td>{{ normdata.assets_income_rate }}</td>
                    <td>销售增长比率</td>
                    <td>{{ normdata.sales_growth_rate }}</td>
                  </tr>
                  <tr>
                    <td colspan="6" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-4-2"
                        placeholder="请填写备注"
                        v-model="censusData.finance_norm_remark"
                        v-focus="'anchor-4-2'"
                        @blur="onReportSave('finance_norm_remark')"
                      ></textarea>
                    </td>
                    <td colspan="6" v-else>
                      <div class="text-indent" id="anchor-4-2">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-4-2'">
                          {{ censusData.finance_norm_remark }}
                        </div>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>
              <table class="table table-bordered">
                <colgroup>
                  <col width="14%" />
                  <col width="18%" />
                  <col width="17%" />
                  <col width="17%" />
                  <col width="17%" />
                  <col width="17%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td :rowspan="8 + twoData.length + threeData.length">项目资金投入明细</td>
                  </tr>
                  <tr>
                    <td colspan="5">3、其它主要科目明细———固定投入情况</td>
                  </tr>
                  <tr>
                    <td>项目</td>
                    <td>规格详情</td>
                    <td>单价（元）</td>
                    <td>金额（万元）</td>
                    <td>备注</td>
                  </tr>
                  <tr v-for="(p, index) of twoData" :key="`two-` + index">
                    <td>{{ p.project_name }}</td>
                    <td>{{ p.uscale }}</td>
                    <td>{{ p.unit_price }}</td>
                    <td>{{ p.funds || '-' }}</td>
                    <td>{{ p.remark }}</td>
                  </tr>
                  <tr>
                    <td>合计</td>
                    <td>—</td>
                    <td>—</td>
                    <td>{{ twoAmount }}</td>
                    <td>-</td>
                  </tr>
                  <tr>
                    <td colspan="5">项目流动资金投入明细</td>
                  </tr>
                  <tr>
                    <td>项目</td>
                    <td>规格详情</td>
                    <td>单价（元）</td>
                    <td>金额（万元）</td>
                    <td>备注</td>
                  </tr>
                  <tr v-for="(p, index) of threeData" :key="`three-` + index">
                    <td>{{ p.project_name }}</td>
                    <td>{{ p.uscale }}</td>
                    <td>{{ p.unit_price }}</td>
                    <td>{{ p.funds }}</td>
                    <td>{{ p.remark }}</td>
                  </tr>
                  <tr>
                    <td>合计</td>
                    <td>—</td>
                    <td>—</td>
                    <td>{{ threeAmount }}</td>
                    <td>—</td>
                  </tr>
                  <tr>
                    <td colspan="5" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-4-3"
                        placeholder="请填写备注"
                        v-model="censusData.input_remark"
                        v-focus="'anchor-4-3'"
                        @blur="onReportSave('input_remark')"
                      ></textarea>
                    </td>
                    <td colspan="5" v-else>
                      <div class="text-indent" id="anchor-4-3">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-4-3'">
                          {{ censusData.input_remark }}
                        </div>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>

              <h3 class="report-section-title" align="center">五、检验核实情况</h3>
              <table class="table table-bordered">
                <colgroup>
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="4">
                      检验核实
                      <br />
                      情况
                    </td>
                  </tr>
                  <tr>
                    <td colspan="9">1、客户信息核实</td>
                  </tr>
                  <tr>
                    <td>营业执照</td>
                    <td>
                      可供抵押
                      <br />
                      房产
                    </td>
                    <td>
                      土地租赁
                      <br />
                      合同
                    </td>
                    <td>供销合同</td>
                    <td>电费</td>
                    <td>存货清单</td>
                    <td>
                      银行存款
                      <br />
                      账户
                    </td>
                    <td>
                      法律诉讼
                      <br />
                      情况
                    </td>
                    <td>其它</td>
                  </tr>
                  <tr>
                    <td v-if="!postStatus">
                      <el-select
                        v-model="postVdata.business_normal"
                        @change="onVdataSave('business_normal')"
                      >
                        <el-option key="0" label="有" value="有"></el-option>
                        <el-option key="1" label="无" value="无"></el-option>
                      </el-select>
                    </td>
                    <td v-else>{{ postVdata.business_normal || '-' }}</td>
                    <td v-if="!postStatus">
                      <el-select
                        v-model="postVdata.mortgage_property"
                        @change="onVdataSave('mortgage_property')"
                      >
                        <el-option key="0" label="无" value="无"></el-option>
                        <el-option key="1" label="有" value="有"></el-option>
                      </el-select>
                    </td>
                    <td v-else>{{ postVdata.mortgage_property || '-' }}</td>
                    <td v-if="!postStatus">
                      <el-select v-model="postVdata.land_lease" @change="onVdataSave('land_lease')">
                        <el-option key="0" label="无" value="无"></el-option>
                        <el-option key="1" label="有" value="有"></el-option>
                      </el-select>
                    </td>
                    <td v-else>{{ postVdata.land_lease || '-' }}</td>
                    <td v-if="!postStatus">
                      <el-select
                        v-model="postVdata.supply_market"
                        @change="onVdataSave('supply_market')"
                      >
                        <el-option key="0" label="无" value="无"></el-option>
                        <el-option key="1" label="有" value="有"></el-option>
                      </el-select>
                    </td>
                    <td v-else>{{ postVdata.supply_market || '-' }}</td>
                    <td v-if="!postStatus">
                      <el-select v-model="postVdata.ele_fee" @change="onVdataSave('ele_fee')">
                        <el-option key="0" label="异常" value="异常"></el-option>
                        <el-option key="1" label="正常" value="正常"></el-option>
                      </el-select>
                    </td>
                    <td v-else>{{ postVdata.ele_fee || '-' }}</td>
                    <td v-if="!postStatus">
                      <el-select v-model="postVdata.stock" @change="onVdataSave('stock')">
                        <el-option key="0" label="无" value="无"></el-option>
                        <el-option key="1" label="有" value="有"></el-option>
                      </el-select>
                    </td>
                    <td v-else>{{ postVdata.stock || '-' }}</td>
                    <td v-if="!postStatus">
                      <el-select
                        v-model="postVdata.bank_account"
                        @change="onVdataSave('bank_account')"
                      >
                        <el-option key="0" label="无" value="无"></el-option>
                        <el-option key="1" label="有" value="有"></el-option>
                      </el-select>
                    </td>
                    <td v-else>{{ postVdata.bank_account || '-' }}</td>
                    <td v-if="!postStatus">
                      <el-select
                        v-model="postVdata.legal_aaction"
                        @change="onVdataSave('legal_aaction')"
                      >
                        <el-option key="0" label="无" value="无"></el-option>
                        <el-option key="1" label="有" value="有"></el-option>
                      </el-select>
                    </td>
                    <td v-else>{{ postVdata.legal_aaction || '-' }}</td>
                    <td v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="1"
                        id="form-5-1-9"
                        placeholder="其它"
                        v-model="postVdata.other"
                        v-focus="'anchor-5-1-9'"
                        @blur="onVdataSave('other')"
                      ></textarea>
                    </td>
                    <td v-else>
                      <div class="text-indent" id="anchor-5-1-9">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-5-1-9'">
                          {{ postVdata.other }}
                        </div>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>
              <table
                class="table table-bordered"
                v-for="(p, index) of bankData"
                :key="`bank-` + index"
              >
                <colgroup>
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="5">
                      检验核实
                      <br />
                      情况
                    </td>
                  </tr>
                  <tr>
                    <td colspan="9">2、现金流分析</td>
                  </tr>
                  <tr>
                    <td>用户名：</td>
                    <td>{{ p.bank_account }}</td>
                    <td>银行名称：</td>
                    <td colspan="3">{{ p.bank_name }}</td>
                    <td>银行账号：</td>
                    <td colspan="2">{{ p.bank_no }}</td>
                  </tr>
                  <tr>
                    <td colspan="2">日期</td>
                    <td colspan="2">收入</td>
                    <td colspan="2">支出</td>
                    <td colspan="3">备注</td>
                  </tr>
                  <tr v-for="(bank, j) of p.bankflow" :key="`bank-${index}-${j}`">
                    <td colspan="2">{{ bank.year }}.{{ bank.month }}</td>
                    <td colspan="2">{{ bank.income || '-' }}</td>
                    <td colspan="2">{{ bank.paid || '-' }}</td>
                    <td colspan="3">{{ bank.remark || '-' }}</td>
                  </tr>
                </tbody>
              </table>
              <table class="table table-bordered">
                <colgroup>
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="3">
                      检验核实
                      <br />
                      情况
                    </td>
                  </tr>
                  <tr>
                    <td colspan="9">2、现金流分析</td>
                  </tr>
                  <tr>
                    <td colspan="9" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-5-2"
                        placeholder="说明"
                        v-model="censusData.bank_flow_des"
                        v-focus="'anchor-5-2'"
                        @blur="onReportSave('bank_flow_des')"
                      ></textarea>
                    </td>
                    <td colspan="9" v-else>
                      <div class="text-indent" id="anchor-5-2">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-5-2'">
                          {{ censusData.bank_flow_des }}
                        </div>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>
              <table class="table table-bordered">
                <colgroup>
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td :rowspan="10">
                      检验核实
                      <br />
                      情况
                    </td>
                  </tr>
                  <tr>
                    <td colspan="9">3、用电分析（针对有独立电表的项目）</td>
                  </tr>
                  <tr>
                    <td colspan="9">
                      <chart-power-use
                        :img-type="true"
                        :width="760"
                        :customer-related-id="customerRelatedId"
                      ></chart-power-use>
                    </td>
                  </tr>
                </tbody>
              </table>
              <table class="table table-bordered">
                <colgroup>
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="3">
                      检验核实
                      <br />
                      情况
                    </td>
                  </tr>
                  <tr>
                    <td colspan="9">3、用电分析（针对有独立电表的项目）</td>
                  </tr>
                  <tr>
                    <td colspan="9" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-5-3"
                        placeholder="用电分析："
                        v-model="censusData.ele_analysis_des"
                        v-focus="'anchor-5-3'"
                        @blur="onReportSave('ele_analysis_des')"
                      ></textarea>
                    </td>
                    <td colspan="9" v-else>
                      <div class="text-indent" id="anchor-5-3">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-5-3'">
                          {{ censusData.ele_analysis_des }}
                        </div>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>

              <h3 class="report-section-title" align="center">六、反担保分析</h3>
              <table class="table table-bordered">
                <colgroup>
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                  <col width="10%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td :rowspan="10 + DescData.length + PostData.length + pledgedata.length">
                      反担保分析
                    </td>
                  </tr>
                  <tr>
                    <td colspan="9">1、反担保措施及评价</td>
                  </tr>
                  <tr>
                    <td colspan="9" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-6-1"
                        placeholder="反担保措施评价"
                        v-model="censusData.counter_guarantee_evaluation"
                        v-focus="'anchor-6-1'"
                        @blur="onReportSave('counter_guarantee_evaluation')"
                      ></textarea>
                    </td>
                    <td colspan="9" v-else>
                      <div class="text-indent" id="anchor-6-1">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-6-1'">
                          {{ censusData.counter_guarantee }}
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="9">2、反担保抵/质押物描述</td>
                  </tr>
                  <tr>
                    <td>保证类型</td>
                    <td colspan="2">单位/公司名称</td>
                    <td colspan="2">姓名/企业名称</td>
                    <td colspan="2">身份证/统一社会信用代码</td>
                    <td>收入</td>
                    <td>备注</td>
                  </tr>
                  <tr v-for="(p, index) of PostData" :key="`pod-` + index">
                    <td>{{ enumPledge[p.warrant_way] }}</td>
                    <td colspan="2">{{ p.warrant_name }}</td>
                    <td colspan="2">{{ p.warrant_own_name }}</td>
                    <td colspan="2">{{ p.id_card }}</td>
                    <td>{{ p.warrant_value }}</td>
                    <td>{{ p.remark }}</td>
                  </tr>
                  <tr>
                    <td>质押类型</td>
                    <td colspan="2">质押物名称</td>
                    <td colspan="2">所有权姓名/企业名称</td>
                    <td colspan="2">身份证/统一社会信用代码</td>
                    <td>比例</td>
                    <td>备注</td>
                  </tr>
                  <tr v-for="(p, index) of pledgedata" :key="`posd-` + index">
                    <td>{{ enumZhiya[p.warrant_way] }}</td>
                    <td colspan="2">{{ p.warrant_name }}</td>
                    <td colspan="2">{{ p.warrant_own_name }}</td>
                    <td colspan="2">{{ p.id_card }}</td>
                    <td>{{ p.warrant_value }}</td>
                    <td>{{ p.remark }}</td>
                  </tr>
                  <tr>
                    <td>抵押类型</td>
                    <td>抵押物名称</td>
                    <td>所有权姓名/企业名称</td>
                    <td>身份证/统一社会信用代码</td>
                    <td>抵押物面积/型号</td>
                    <td>抵押物原值/面值</td>
                    <td>估值</td>
                    <td>抵押率</td>
                    <td>备注</td>
                  </tr>
                  <tr v-for="(p, index) of mortgagedata" :key="`mostd-` + index">
                    <td>{{ enumDiya[p.warrant_way] }}</td>
                    <td>{{ p.warrant_name }}</td>
                    <td>{{ p.warrant_own_name }}</td>
                    <td>{{ p.id_card }}</td>
                    <td>{{ p.warrant_model }}</td>
                    <td>{{ p.warrant_value }}</td>
                    <td>{{ p.warrant_evalue }}</td>
                    <td>{{ p.pledge_rate }}</td>
                    <td>{{ p.remark }}</td>
                  </tr>
                  <tr>
                    <td colspan="9" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-6-2"
                        placeholder="反担保措施"
                        v-model="censusData.counter_guarantee"
                        v-focus="'anchor-6-2'"
                        @blur="onReportSave('counter_guarantee')"
                      ></textarea>
                    </td>
                    <td colspan="9" v-else>
                      <div class="text-indent" id="anchor-6-2">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-6-2'">
                          {{ censusData.counter_guarantee }}
                        </div>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>

              <h3 class="report-section-title" align="center">七、项目优劣势及风险控制分析</h3>
              <table class="table table-bordered">
                <colgroup>
                  <col width="15%" />
                  <col width="25%" />
                  <col width="20%" />
                  <col width="20%" />
                  <col width="20%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="10">
                      贷款风险分析及
                      <br />
                      控制措施
                    </td>
                  </tr>
                  <tr>
                    <td colspan="4">1、优势方面</td>
                  </tr>
                  <tr>
                    <td colspan="4" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-7-1"
                        placeholder="优势方面"
                        v-model="censusData.advantage_analysis"
                        v-focus="'anchor-7-1'"
                        @blur="onReportSave('advantage_analysis')"
                      ></textarea>
                    </td>
                    <td colspan="4" v-else>
                      <div class="text-indent" id="anchor-7-1">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-7-1'">
                          {{ censusData.advantage_analysis }}
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="4">2、劣势方面</td>
                  </tr>
                  <tr>
                    <td colspan="4" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-7-2"
                        placeholder="劣势方面"
                        v-model="censusData.disadvantage_analysis"
                        v-focus="'anchor-7-2'"
                        @blur="onReportSave('disadvantage_analysis')"
                      ></textarea>
                    </td>
                    <td colspan="4" v-else>
                      <div class="text-indent" id="anchor-7-2">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-7-2'">
                          {{ censusData.disadvantage_analysis }}
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="4">3、项目风险分析</td>
                  </tr>
                  <tr>
                    <td colspan="4" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-7-3"
                        placeholder="项目风险分析"
                        v-model="censusData.project_risk_analysis"
                        v-focus="'anchor-7-3'"
                        @blur="onReportSave('project_risk_analysis')"
                      ></textarea>
                    </td>
                    <td colspan="4" v-else>
                      <div class="text-indent" id="anchor-7-3">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-7-3'">
                          {{ censusData.project_risk_analysis }}
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="4">4、还款能力及还款计划</td>
                  </tr>
                  <tr>
                    <td colspan="4" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="4"
                        id="form-7-4"
                        placeholder="还款能力及还款计划"
                        v-model="censusData.repayment_plan"
                        v-focus="'anchor-7-4'"
                        @blur="onReportSave('repayment_plan')"
                      ></textarea>
                    </td>
                    <td colspan="4" v-else>
                      <div class="text-indent" id="anchor-7-4">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-7-4'">
                          {{ censusData.repayment_plan }}
                        </div>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>

              <h3 class="report-section-title" align="center">八、调查结论和意见</h3>
              <table class="table table-bordered">
                <colgroup>
                  <col width="15%" />
                  <col width="20%" />
                  <col width="20%" />
                  <col width="20%" />
                  <col width="25%" />
                </colgroup>
                <tbody>
                  <tr>
                    <td rowspan="10">调查结论意见</td>
                  </tr>
                  <tr>
                    <td colspan="4">1、调查报告意见</td>
                  </tr>
                  <tr>
                    <td colspan="4" v-if="!postStatus">
                      <textarea
                        class="form-control"
                        rows="4"
                        placeholder="调查报告意见"
                        id="form-8-1"
                        v-model="censusData.census_opinion"
                        v-focus="'anchor-8-1'"
                        @blur="onReportSave('census_opinion')"
                      ></textarea>
                    </td>
                    <td colspan="4" v-else>
                      <div class="text-indent" id="anchor-8-1">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-8-1'">
                          {{ censusData.census_opinion }}
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="4">2、风控人员意见</td>
                  </tr>
                  <tr>
                    <td colspan="4" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="2"
                        id="form-8-2"
                        placeholder="风控人员意见"
                        v-model="censusData.risk_option"
                        v-focus="'anchor-8-2'"
                        @blur="onReportSave('risk_option')"
                      ></textarea>
                    </td>
                    <td colspan="4" v-else>
                      <div class="text-indent" id="anchor-8-2">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-8-2'">
                          {{ censusData.risk_option }}
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="4">3、相关人意见</td>
                  </tr>
                  <tr>
                    <td>调查员A角意见：</td>
                    <td colspan="3" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="2"
                        id="form-8-3-1"
                        placeholder="调查员A角意见"
                        v-model="censusData.a_opinion"
                        v-focus="'anchor-8-3-1'"
                        @blur="onReportSave('a_opinion')"
                      ></textarea>
                      <el-row :gutter="20">
                        <el-col :span="6" :offset="1">签字：</el-col>
                        <el-col :span="6" :offset="6">日期：</el-col>
                      </el-row>
                    </td>
                    <td colspan="3" v-else>
                      <div class="text-indent" id="anchor-8-3-1">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-8-3-1'">
                          {{ censusData.a_opinion }}
                        </div>
                      </div>
                      <el-row :gutter="20">
                        <el-col :span="6" :offset="1">签字：</el-col>
                        <el-col :span="6" :offset="6">日期：</el-col>
                      </el-row>
                    </td>
                  </tr>
                  <tr>
                    <td>调查员B角意见：</td>
                    <td colspan="3" v-if="!postStatus">
                      <textarea
                        type="text"
                        class="form-control d-print-none"
                        rows="2"
                        id="form-8-3-2"
                        placeholder="调查员B角意见"
                        v-model="censusData.b_opinion"
                        v-focus="'anchor-8-3-2'"
                        @blur="onReportSave('b_opinion')"
                      ></textarea>
                      <el-row :gutter="20">
                        <el-col :span="6" :offset="1">签字：</el-col>
                        <el-col :span="6" :offset="6">日期：</el-col>
                      </el-row>
                    </td>
                    <td colspan="3" v-else>
                      <div class="text-indent" id="anchor-8-3-2">
                        <div class="edit-eara" v-anchor:report-edit.focus="'form-8-3-2'">
                          {{ censusData.b_opinion }}
                        </div>
                      </div>
                      <el-row :gutter="20">
                        <el-col :span="6" :offset="1">签字：</el-col>
                        <el-col :span="6" :offset="6">日期：</el-col>
                      </el-row>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>

      <!--<div class="card scroll-y p-5">-->
      <!--<div class="report-body">-->

      <!--<chart-power-use :img-type="true"-->
      <!--:width="760"-->
      <!--:customer-related-id="customerRelatedId"></chart-power-use>-->
      <!--</div>-->
      <!--</div>-->
    </div>
  </div>
</template>
<script>
import {
  enumSexType,
  enumEduType,
  enumFarmType,
  enumEleUseType,
  enumCorpType,
  enumMarrType,
  enumTypeer,
  enumAssetsType,
  enumOwnSit,
  enumWarrantWayType,
  enumWarrantType,
  enumZhiya,
  enumDiya,
  enumPledge,
} from '@/credit/plugins/enum'
import { scroll } from '@/common/plugins/tools/common'
import { printHtml, domAddClass, domRemoveClass } from '@vimi/utils-tool'
import { formatLine } from '@/common/plugins/format'
import ChartPowerUse from '@/credit/components/chart/ChartPowerUse'
import SelectStaffper from '@/credit/components/select/SelectStaffper'
const CREDIT_SERVER = 'credit'

export default {
  components: {
    ChartPowerUse,
    SelectStaffper,
  },
  props: {
    viewMode: Boolean,
    relatedId: String,
  },
  data() {
    return {
      enumSexType,
      enumEduType,
      enumFarmType,
      enumEleUseType,
      enumCorpType,
      enumMarrType,
      enumTypeer,
      enumAssetsType,
      enumOwnSit,
      enumWarrantWayType,
      enumWarrantType,
      enumZhiya,
      enumDiya,
      enumPledge,
      // 项目基本信息
      relatedData: {},
      // 报告
      censusData: {},
      reportData: {},
      // 企业法人情况
      Presonsum: 0,
      comRateData: [],
      shareData: [{}],
      shareholderData: {},
      // 企业基本情况
      infoData: {},
      // 用工情况
      employmentData: {},
      // 征信
      topData: [],
      datalength: 0,
      name: [],
      // 银行卡信息
      Carddata: [],
      cardData: {},
      carData: {},
      // 申请人对外担保情况
      Foreign: [],
      // 人员信息
      dataInfoSh: [], // 股东信息（包括法人与配偶）,
      // 个人/公司财产
      assetsData: [],
      // 主要供货商
      Gdata: [],
      all: 0,
      // 销售商信息
      Xdata: [],
      All: 0,
      // 财务情况
      FinanceData: {},
      normdata: {},
      // 固定投入情况
      twoData: [],
      twoAmount: 0,
      // 流动情况
      threeData: [],
      threeAmount: 0,
      // 客户信息核实
      postVdata: {},
      vdata: {},
      // 现金流分析
      bankData: [],
      // 反担保抵/质押物描述
      DescData: [],
      PostData: [],
      pledgedata: [],
      mortgagedata: [],
      postStatus: false,
      // myou
      customerRelatedId: this.relatedId,
      // 尽调报告
      censusId: '',
      dataCensus: {
        customer_id: '',
        customer_related_id: '',
      },
      dataCensusSolid: {},

      // 保存
      focusFromReport: false,
      saveLoading: false,
    }
  },
  computed: {},
  watch: {
    relatedId() {
      this.init()
    },
  },
  created() {
    this.id = this.$route.query.id || sessionStorage.getItem('customer_related_id')
    window.addEventListener('resize', this.initHeight)
    this.init()
  },
  mounted() {},
  methods: {
    formatLine,
    init() {
      this.initHeight()

      this.customerRelatedId = this.relatedId || this.$route.query.id
      if (!this.customerRelatedId) {
        return false
      }

      this.dataCensus.customer_related_id = this.customerRelatedId

      this.getData()
    },

    initHeight() {
      // const clientHeight = document.documentElement.clientHeight || document.body.clientHeight || window.innerHeight
    },

    // 客户及关联信息
    getData() {
      this.getRelatedData()
      this.getCensusData()
      this.getShareholderData()
      this.getInfoData()
      this.getPersonnelData()
      this.getForeignData()
      this.getDataBaseSh()
      this.getAssetsData()
      this.getGSata()
      this.getFinanceData()
      this.getTData()
      this.getProjectData()
      this.getVData()
      this.getBankData()
      this.getGuarantData()
      this.getDataBase()
      this.getCensusReport()
    },
    // 关联基本信息
    async getDataBase() {
      const [res] = await this.$utils.promise(
        this.$api.getData(CREDIT_SERVER, 'customer_related_view', {
          index: 1,
          size: 1,
          'customer_related_id.eq': this.customerRelatedId,
        })
      )

      if (res && res.data && res.data.data && res.data.data.length) {
        this.dataBase = res.data.data[0]

        this.dataCensus.customer_id = this.dataBase.customer_id
        this.dataCensusSolid = { ...this.dataCensus }
      }
    },
    // 尽调报告
    async getCensusReport() {
      const [res] = await this.$utils.promise(
        this.$api.getData(CREDIT_SERVER, 'credit_census_report', {
          index: 1,
          size: 1,
          'customer_related_id.eq': this.customerRelatedId,
        })
      )
      if (res && res.data && res.data.data && res.data.data.length) {
        const data = res.data.data[0]
        this.censusId = data.id
        Object.keys(this.dataCensus).forEach(key => {
          this.dataCensus[key] = data[key]
        })
        this.dataCensusSolid = { ...this.dataCensus }
      }
    },
    getGuarantData() {
      this.$api
        .getData('credit', 'datum_customer_warrant', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res.data) {
            this.DescData = res.data
            for (let p of res.data) {
              if (p.warrant_type === '1') {
                this.PostData.push(p)
              } else if (p.warrant_type === '2') {
                this.pledgedata.push(p)
              } else {
                this.mortgagedata.push(p)
              }
            }
          }
        })
    },
    getBankData() {
      this.$api
        .getData('credit', 'datum_customer_finance_bank_account', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res.data) {
            for (let rd of res.data) {
              rd.bankflow = []
            }
            this.bankData = res.data
            this.getBanKdata()
          }
        })
    },
    getBanKdata() {
      this.$api.getData('credit', 'datum_customer_finance_bank').then(res => {
        if (res) {
          let data = res.data || []
          for (let d of this.bankData) {
            d.bankflow = []
            for (let i = 0; i < data.length; i++) {
              let we = data[i]
              if (
                we.datum_customer_finance_bank_account_id ===
                d.datum_customer_finance_bank_account_id
              ) {
                d.bankflow.push(we)
                data.splice(i, 1)
              }
            }
          }
        }
      })
    },
    getVData() {
      this.$api
        .getData('credit', 'datum_customer_info_verify', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res.data) {
            this.postVdata = res.data[0]
            this.vdata = { ...this.postVdata }
          }
        })
    },
    getProjectData() {
      this.twoAmount = 0
      this.threeAmount = 0
      this.twoData = []
      this.threeData = []
      this.$api
        .getData('credit', 'datum_customer_finance_project_input', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res.data) {
            let solidTotal = 0
            let flowTotal = 0
            for (const d of res.data) {
              const t = Number.parseFloat(d.funds)
              const o = isNaN(t) ? 0 : t
              if (d.input_type === '1') {
                this.twoData.push(d)
                solidTotal += o
              } else {
                this.threeData.push(d)
                flowTotal += o
              }
            }
            this.twoAmount = Math.round(solidTotal * 100) / 100
            this.threeAmount = Math.round(flowTotal * 100) / 100
          }
        })
    },
    getTData() {
      this.$api
        .getData('credit', 'datum_customer_finance_norm', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res.data) {
            this.normdata = res.data[0]
          }
        })
    },
    getFinanceData() {
      this.$api
        .getData('credit', 'datum_customer_finance_report', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res && res.data) {
            this.FinanceData = res.data[0]
          }
        })
    },
    getGSata() {
      this.Gdata = []
      this.Xdata = []
      this.all = 0
      this.All = 0
      this.$api
        .getData('credit', 'datum_customer_business_sm', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res.data) {
            let solidTotal = 0
            let flowTotal = 0
            for (const d of res.data) {
              const t = Number.parseFloat(d.current_year_total)
              const o = isNaN(t) ? 0 : t
              if (d.sm_type === '1') {
                this.Gdata.push(d)
                solidTotal += o
              } else {
                this.Xdata.push(d)
                flowTotal += o
              }
            }
            this.all = Math.round(solidTotal * 100) / 100
            this.All = Math.round(flowTotal * 100) / 100
          }
        })
    },
    getAssetsData() {
      this.$api
        .getData('credit', 'datum_customer_assets', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res && res.data) {
            this.assetsData = res.data
          }
        })
    },
    getDataBaseSh() {
      this.$api
        .getData('credit', 'datum_customer_shareholder_view', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          for (let rd of res.data) {
            rd.handEdu = []
            rd.workExp = []
          }
          this.dataInfoSh = res.data
          this.getHandEducation()
          this.getWorkExp()
        })
    },
    getWorkExp() {
      this.$api
        .getData('credit', 'datum_customer_work_exp', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res) {
            // 给每个员工添加工作经历
            let data = res.data || []
            for (const d of this.dataInfoSh) {
              d.workExp = []
              for (let i = 0; i < data.length; i++) {
                let we = data[i]
                if (we.datum_customer_shareholder_id === d.datum_customer_shareholder_id) {
                  we.datePeriod = `${this.$utils.dateFormat(
                    we.start_date,
                    'yyyy.MM'
                  )}-${this.$utils.dateFormat(we.end_date, 'yyyy.MM')}`
                  d.workExp.push(we)
                  data.splice(i, 1)
                }
              }
              if (!d.workExp.length) {
                d.workExp.push({
                  datePeriod: '-',
                  age_inter: '-',
                  customer_name: '-',
                  work_unit: '-',
                  end_date: '-',
                  assets_total: '-',
                  remark: '-',
                  start_date: '-',
                })
              }
            }
          }
        })
    },
    getHandEducation() {
      this.$api
        .getData('credit', 'datum_customer_hand_education', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res) {
            // 给每个员工添加受教育情况
            let data = res.data || []
            for (let d of this.dataInfoSh) {
              d.handEdu = []
              for (let i = 0; i < data.length; i++) {
                let he = data[i]
                if (he.datum_customer_shareholder_id === d.datum_customer_shareholder_id) {
                  he.datePeriod = `${this.$utils.dateFormat(
                    he.start_date,
                    'yyyy.MM'
                  )}-${this.$utils.dateFormat(he.end_date, 'yyyy.MM')}`
                  d.handEdu.push(he)
                  data.splice(i, 1)
                }
              }
              if (!d.handEdu.length) {
                d.handEdu.push({
                  datePeriod: '-',
                  age_inter: '-',
                  customer_name: '-',
                  education_mech: '-',
                  end_date: '-',
                  profession: '-',
                  remark: '-',
                  start_date: '-',
                })
              }
            }
          }
        })
    },
    getForeignData() {
      this.$api
        .getData('credit', 'datum_customer_warrant_foreign', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res && res.data) {
            this.Foreign = res.data
          }
        })
    },
    // 用工情况信息
    getPersonnelData() {
      this.$api
        .getData('credit', 'datum_customer_emp', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (res && res.data) {
            this.employmentData = res.data[0]
          }
        })
    },
    getInfoData() {
      this.$api
        .getData('credit', 'datum_customer_info', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (!res.data || !res.data.length) {
            return
          }
          this.infoData = res.data[0]
        })
    },
    getShareholderData() {
      this.$api
        .getData('credit', 'datum_customer_shareholder_view', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (!res.data || !res.data.length) {
            return
          }
          this.shareholderData = res.data[0]
          this.shareData = res.data
          this.Presonsum = 0
          this.comRateData = []
          for (let p of res.data) {
            if (parseFloat(p.sh_rate) > 0) {
              this.comRateData.push(p)
              this.Presonsum++
            }
          }
          this.name = []
          for (let p of res.data) {
            let t = {}
            t.datum_customer_shareholder_id = p.datum_customer_shareholder_id
            t.real_name = p.real_name
            this.name.push(t)
          }
        })
        .then(() => {
          this.getTopData()
          this.getCardData()
        })
    },
    getCardData() {
      this.$api
        .getData('credit', 'datum_customer_credit_card', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (!res.data || !res.data.length) {
            return
          }
          for (let p of res.data) {
            const index = this.name.findIndex(
              it => it.datum_customer_shareholder_id === p.datum_customer_shareholder_id
            )
            if (index > -1) {
              p.name = this.name[index].real_name
            }
          }
          this.Carddata = res.data
          this.cardData = res.data[0]
          this.carData = { ...this.cardData }
          for (let t = 0; t < this.Carddata.length - 1; t++) {
            this.Carddata[t].rowspan = 1
            for (let m = t + 1; m < this.Carddata.length; m++) {
              if (
                this.Carddata[t].datum_customer_shareholder_id ===
                this.Carddata[m].datum_customer_shareholder_id
              ) {
                this.Carddata[t].rowspan++
                this.Carddata[m].show = true
              }
            }
          }
        })
    },
    getTopData() {
      this.$api
        .getData('credit', 'datum_customer_credit', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          let data = []
          if (res.data) {
            for (let p of res.data) {
              if (!p.start_date) {
                p.start_date = ''
              }
              if (!p.end_date) {
                p.end_date = ''
              }
              const index = this.name.findIndex(
                it => it.datum_customer_shareholder_id === p.datum_customer_shareholder_id
              )
              if (index > -1) {
                p.name = this.name[index].real_name
              }
              if (p.datum_customer_shareholder_id === p.customer_id) {
                p.name = p.customer_name
              }
            }
            this.topData = []
            data = res.data
            for (let t = 0; t < data.length - 1; t++) {
              data[t].rowspan = 1
              for (let m = t + 1; m < data.length; m++) {
                if (
                  data[t].datum_customer_shareholder_id === data[m].datum_customer_shareholder_id
                ) {
                  data[t].rowspan++
                  data[m].show = true
                }
              }
            }
            let sum = 0
            let leftsum = 0
            for (let t = 0; t < data.length; t++) {
              sum += Number(data[t].loan_funds)
              if (data[t].rowspan === 1 || !data[t].rowspan) {
                data[t].sum = sum.toFixed(2)
                sum = 0
              }
              leftsum += Number(data[t].loan_left)
              if (data[t].rowspan === 1 || !data[t].rowspan) {
                data[t].leftsum = leftsum.toFixed(2)
                leftsum = 0
              }
            }
            for (let p of data) {
              if (!p.rowspan || p.rowspan === 1) {
                // 每一个名字相同的征信有一个备注 记住备注长度用于第一列的rowspan
                this.datalength++
              }
              this.topData.push({ data: p, remark: p.remark })
            }
          }
        })
    },
    getCensusData() {
      this.$api
        .getData('credit', 'credit_census_report', {
          'customer_related_id.eq': this.id,
        })
        .then(res => {
          if (!res.data || !res.data.length) {
            return
          }
          this.censusData = res.data[0]
          this.reportData = { ...this.censusData }
        })
    },
    getRelatedData() {
      this.$api
        .getData(
          'credit',
          'customer_related_view',
          {
            'customer_related_id.eq': this.id,
          },
          {
            create_time: 'desc',
          }
        )
        .then(res => {
          if (!res.data || !res.data.length) {
            return
          }
          this.relatedData = res.data[0]
        })
    },
    async onReportSave(key) {
      let data = {}
      if (this.censusData[key] !== this.reportData[key]) {
        data[key] = this.censusData[key]
        if (this.censusData.id) {
          let [res, err] = await this.$utils.promise(
            this.$api.updateData('credit', 'credit_census_report', this.censusData.id, data)
          )
          if (res) {
            this.$message.success('数据采集成功！')
            this.getCensusData()
          } else {
            this.$message.error(`数据采集失败，请重试！（${err.status}）`)
          }
        } else {
          data.census_status = '1'
          data.customer_related_id = this.id
          data.customer_id = this.relatedData.customer_id
          const [res, err] = await this.$utils.promise(
            this.$api.addData('credit', 'credit_census_report', data)
          )
          this.saveLoading = false
          if (res) {
            this.$message.success('数据采集成功！')
            this.getCensusData()
          } else {
            this.$message.error(`数据采集失败，请重试！（${err.status}）`)
          }
        }
      }
    },
    async onCreditSave(data, personId) {
      let Putdata = {}
      for (let p of this.topData) {
        if (personId === p.data.datum_customer_shareholder_id) {
          Putdata.remark = data
          let [res, err] = await this.$utils.promise(
            this.$api.updateData('credit', 'datum_customer_credit', p.data.id, Putdata)
          )
          if (res) {
            this.$message.success('数据采集成功！')
            this.getTopData()
          } else {
            this.$message.error(`数据采集失败，请重试！（${err.status}）`)
          }
        }
      }
    },
    async onCredsumbit(key) {
      let data = {}
      if (this.cardData[key] !== this.carData[key]) {
        data[key] = this.cardData[key]
        if (this.cardData.id) {
          let [res, err] = await this.$utils.promise(
            this.$api.updateData('credit', 'datum_customer_credit_card', this.cardData.id, data)
          )
          if (res) {
            this.$message.success('数据采集成功！')
            this.getCardData()
          } else {
            this.$message.error(`数据采集失败，请重试！（${err.status}）`)
          }
        } else {
          data.customer_related_id = this.id
          data.customer_name = this.relatedData.customer_name
          data.customer_id = this.relatedData.customer_id
          const [res, err] = await this.$utils.promise(
            this.$api.addData('credit', 'datum_customer_credit_card', data)
          )
          this.saveLoading = false
          if (res) {
            this.$message.success('数据采集成功！')
            this.getCardData()
          } else {
            this.$message.error(`数据采集失败，请重试！（${err.status}）`)
          }
        }
      }
    },
    async onVdataSave(key) {
      let data = {}
      if (this.postVdata[key] !== this.vdata[key]) {
        data[key] = this.postVdata[key]
        if (this.postVdata.id) {
          let [res, err] = await this.$utils.promise(
            this.$api.updateData('credit', 'datum_customer_info_verify', this.postVdata.id, data)
          )
          if (res) {
            this.$message.success('数据采集成功！')
            this.getVData()
          } else {
            this.$message.error(`数据采集失败，请重试！（${err.status}）`)
          }
        } else {
          data.customer_related_id = this.id
          data.customer_id = this.relatedData.customer_id
          const [res, err] = await this.$utils.promise(
            this.$api.addData('credit', 'datum_customer_info_verify', data)
          )
          this.saveLoading = false
          if (res) {
            this.$message.success('数据采集成功！')
            this.getVData()
          } else {
            this.$message.error(`数据采集失败，请重试！（${err.status}）`)
          }
        }
      }
    },
    // async onFinishCencus() {
    //   let data = {...this.censusData}
    //   if (!this.censusData.id) { return this.$message.warning('请先填写信息！') }
    //   data.census_status = '2'
    //   let [res, err] = await this.$utils.promise(this.$api.updateData('credit', 'credit_census_report', data.id,  data))
    //   if (res) {
    //     this.$message.success('数据采集成功！')
    //     this.getData()
    //   }else {
    //     this.$message.error(`数据采集失败，请重试！（${err.status}）`)
    //   }
    // },

    onFinishCencus() {
      this.deleteMsgBox({
        message: '确定完成（请确认信息已保存，完成后不能再修改）？',
        beforeClose: async () => {
          await this.$api.updateData(CREDIT_SERVER, 'credit_census_report', this.censusData.id, {
            census_status: 2,
          })
        },
        afterClose: this.getData,
      })
    },

    deleteMsgBox({
      title = '提示',
      message = '确定删除？',
      beforeClose = () => {},
      afterClose = () => {},
      actionMessage = '删除中...',
      successMessage = '删除成功！',
      errorMessage = '删除失败，请重试！',
    }) {
      const self = this
      this.$msgbox({
        title: title,
        message: this.$createElement('span', undefined, message),
        showCancelButton: true,
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        beforeClose: async (action, instance, done) => {
          function afterSuccess() {
            afterClose()
            self.$message.success(successMessage)
            instance.confirmButtonLoading = false
            instance.confirmButtonText = '确定'
            done()
          }

          if (action === 'confirm') {
            instance.confirmButtonLoading = true
            instance.confirmButtonText = actionMessage

            const before = beforeClose()
            if (before.then) {
              before
                .then(() => {
                  afterSuccess()
                })
                .catch(() => {
                  self.$message.error(errorMessage)
                })
            } else {
              afterSuccess()
            }
          } else {
            done()
          }
        },
      }).catch(() => {})
    },

    onPrint() {
      this.postStatus = true
      this.printLoading = true
      setTimeout(() => {
        this.printLoading = false
        this.postStatus = false
        printHtml(
          document.getElementById('report-body').innerHTML,
          `
            .table-border-black tr > td, .table-border-black tr > th { border-color: #333 !important; font-size: 1.25rem;line-height: 1.5; }
            .table-bordered thead td, .table-bordered thead th {border-bottom-width: 1px;}
            .text-indent {text-indent: 3rem;}
            `
        )
      }, 300)
    },
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.initHeight)
  },
  directives: {
    anchor: {
      bind(el, binding, vnode) {
        el.onclick = () => {
          const anchor = document.getElementById(binding.value)
          const target = document.getElementById(binding.arg || 'report-body')
          if (anchor && target) {
            scroll(target, anchor.offsetTop)
            if (binding.modifiers.focus) {
              vnode.context.focusFromReport = true
              anchor.focus()
              setTimeout(() => {
                vnode.context.focusFromReport = false
              }, 50)
            }
          }
        }
      },
    },
    focus: {
      bind(el, binding, vnode) {
        el.onfocus = () => {
          const anchor = document.getElementById(binding.value)
          const target = document.getElementById(binding.arg || 'report-body')
          const autoScroll = !vnode.context.focusFromReport
          if (anchor && target && autoScroll) {
            scroll(target, anchor.offsetTop)
            domAddClass(anchor, 'on-edit')
          }
        }
        el.onblur = () => {
          const anchor = document.getElementById(binding.value)
          if (anchor) {
            domRemoveClass(anchor, 'on-edit')
          }
        }
      },
    },
  },
}
</script>
<style lang="scss" scoped>
$report-width: 100%;
$report-input-border-color: #333;

.report-action {
  width: $report-width;
  margin: 1rem auto;
}

.report-wrap {
  width: $report-width;
  margin: 0 auto;
  padding: 2rem;
  border: 1px solid #e9ecef;
  border-radius: 2px;
  background-color: #fff;
  font-family: SimSun;
  .report-title {
    text-align: center;
    margin-bottom: 1rem;
    font-weight: bold;
    font-size: 1.6rem;
    line-height: 2.5;
  }
  .report-section {
    margin-bottom: 1rem;
    .table-bordered td {
      border-color: #333;
      padding: 0.25rem;
      text-align: center;
      vertical-align: middle;
      &.report-input-last-td {
        border-right-color: $report-input-border-color;
      }
      &.report-input-td {
        border-color: $report-input-border-color;
        background-color: #ffffee;
        padding: 0;
        .form-control {
          border: none;
          background-color: #ffffee;
          padding: 0.25rem;
        }
      }
    }
  }
  .report-complete .report-input-td {
    background-color: #ffffff !important;
  }
  .report-section-title {
    font-size: 1rem;
    font-weight: bold;
  }
}
</style>
